package com.orhon.smartcampus.modules.baseinfo.entity;

import com.orhon.smartcampus.modules.base.entity.Schools;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 消息分类表
 * 
 * @author zy
 * @date 2019-10-29 15:05:12
 */
@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "message_category", schema = "smartcloud", catalog = "")
public class MessageCategory {

	/**
	 * 
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	private Long id;
	/**
	 * 消息分类名称
	 */
	@Column(name = "category_name", nullable = true)
	private String categoryName;
	/**
	 * 消息分类值(school student)
	 */
	@Column(name = "category_value", nullable = true)
	private String categoryValue;
	/**
	 * 创建时间
	 */
	@Column(name = "create_time", nullable = true)
	private Date createTime;
	/**
	 * 创建用户
	 */
	@Column(name = "create_user", nullable = true)
	private Long createUser;
	/**
	 * 消息分类说明
	 */
	@Column(name = "category_explain", nullable = true)
	private String categoryExplain;

	/**
	 * 消息分类删除标识
	 */
	@Column(name = "deleted_at", nullable = true)
	private Date deletedAt;

	/**
	 * 消息分类图标
	 */
	@Column(name = "icon", nullable = true)
	private String icon;

	/**
	 * 微信推送消息模版ID
	 */
	@Column(name = "template_id", nullable = true)
	private String templateId;

	@ManyToOne
	@JoinColumn(name = "school_id", referencedColumnName = "id")
	@Where(clause = "ISNULL(deleted_at)")
	@NotFound(action=NotFoundAction.IGNORE)
	private Schools baseSchoolsBySchoolId;
}
